package model

import (
	"github.com/Gre-Z/common/jtime"
	"gorm.io/datatypes"
)

type Event struct {
	Id               uint64           `json:"id" gorm:"column:id;primaryKey;type:int;autoIncrement"`
	Name             string           `json:"name" binding:"max=255" gorm:"column:name"`
	Type             string           `json:"type" binding:"max=20" gorm:"column:type"`
	Param            datatypes.JSON   `json:"param"  gorm:"column:param"`
	Sort             uint8            `json:"sort" binding:"max=65534" gorm:"column:sort;type:int"`
	PlayId           uint64           `json:"play_id" gorm:"column:play_id;type:int"`
	StoryId          uint64           `json:"story_id" gorm:"column:story_id;type:int"`
	ActionId         uint64           `json:"action_id" gorm:"column:action_id;type:int"`
	PlayRoleId       uint64           `json:"play_role_id" gorm:"column:play_role_id;type:int"`
	LineMediaId      uint64           `json:"line_media_id" gorm:"column:line_media_id;type:int"`
	GroupId          uint64           `json:"group_id" gorm:"column:group_id;type:int"`
	ShotId           uint64           `json:"shot_id" gorm:"column:shot_id;type:int"`
	LightId          uint64           `json:"light_id" gorm:"column:light_id;type:int"`
	ActionText       string           `json:"action_text" binding:"max=512" gorm:"column:action_text"`
	ShotText         string           `json:"shot_text" binding:"max=512" gorm:"column:shot_text"`
	LineText         string           `json:"line_text" binding:"max=512" gorm:"column:line_text"`
	LineVideoMediaId uint64           `json:"line_video_media_id" gorm:"column:line_video_media_id"`
	IsSendCommand    string           `json:"is_send_command"  gorm:"column:is_send_command;default:'no'"`
	Created          jtime.TstampTime `json:"created" gorm:"column:created;autoCreateTime"`
	Updated          jtime.TstampTime `json:"updated" gorm:"column:updated;autoUpdateTime"`
	PlayRole         PlayRole         `json:"play_role" gorm:"foreignKey:id;references:play_role_id"`
	Action           Action           `json:"action" gorm:"foreignKey:id;references:action_id"`
	Light            Light            `json:"light" gorm:"foreignKey:id;references:light_id"`
	Shot             Shot             `json:"shot" gorm:"foreignKey:id;references:shot_id"`
	LineMedia        Media            `json:"line_media" gorm:"foreignKey:id;references:line_media_id"`
	LineVideoMedia   Media            `json:"line_video_media" gorm:"foreignKey:id;references:line_video_media_id"`
}

// 设置表名
func (Event) TableName() string {
	return "event"
}
